#ifndef INPUT_YUYV_H
#define INPUT_YUYV_H

#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<linux/videodev2.h>
#include<fcntl.h>
#include<string.h>
#include<errno.h>
#include<sys/mman.h>
#include <sys/types.h>

#include "../input.h"
#include "yuyv_jpeg.h"


typedef struct _BUFFER_A BUFFER_A;
struct _BUFFER_A
{
    unsigned char * bufStart;
    size_t length;
};

typedef struct _JPEG_BUFFERS JPEG_BUFFERS;
struct _JPEG_BUFFERS
{
    unsigned char * bufStart;
    size_t length;
};

typedef struct _INPUT_CONTROL INPUT_CONTROL;
struct _INPUT_CONTROL
{
    struct v4l2_capability cap;
    struct v4l2_format format;
    struct v4l2_streamparm setfps;
    struct v4l2_requestbuffers reqbuf;
    struct v4l2_buffer querybuf;
};

//INPUT_CONTROL input_control;

typedef struct _INPUT_INFO	INPUT_INFO;
struct _INPUT_INFO
{
    char *deviceName;
    unsigned int frameWidth;
    unsigned int frameHeight;
    unsigned short frameRate;
    unsigned short quality;
    int format;
};


int input_init(char *inputName, void *pglobal);
int input_run(void);
int input_stop(void);
#endif
